package com.ma4567.remotecontroller.util;

import java.io.File;
import java.util.ArrayList;

public class LocalFileScanner {
    public static ArrayList<com.ma4567.remotecontroller.util.File> GetDictoryFile(String DirectoryPath){
        ArrayList<com.ma4567.remotecontroller.util.File> Result = new ArrayList<com.ma4567.remotecontroller.util.File>();

        if("Root".contains(DirectoryPath)){
            File[] roots = File.listRoots();
            for(File root : roots){
                Result.add(new com.ma4567.remotecontroller.util.File(root.getPath(), root.getPath(), "Disk"));
            }
            return Result;
        }

        File temp = new File(DirectoryPath);
        if(temp.exists()){
            if(temp.isDirectory()){
                File[] DirectoryFiles = temp.listFiles();

                for (File f : DirectoryFiles) {
                    Result.add(new com.ma4567.remotecontroller.util.File(f.getPath(), f.getName(), "null"));
                }
            }
        }

        return Result;
    }
}
